<template>
  <div class="ai-robot font14">
    <p>{{$t('configLazyLoad.robotSeven.robotJumpTip1')}}<a :href="url" v-show="url" target="_blank">{{$t('configLazyLoad.robotSeven.robotJumpTip2')}}</a></p>
    <!--<el-button type="primary" class="primary_btn" @click.stop="openAI()">跳转到AI系统进行设置</el-button>-->
  </div>
</template>

<script>
    import bus from '@/store/eventBus'
    export default {
      name: 'aiRobotConfig',
      data () {
        return {
          url: ''
        }
      },
      methods: {
        openAI () {
          this.$store.dispatch('m7AiRobotLogin', {}).then(res => {
            if (res.success) {
              let user = this.$store.state.session.user
              let account = user ? user.account : ''
              this.url = document.location.protocol + res.url + '&Account=' + account
            }
          })
        }
      },
      mounted () {
        this.openAI()
        bus.$on('openNewAIUrl', (msg) => {
          this.url = msg
        })
      },
      beforeDestroy () {
        bus.$off('openNewAIUrl')
      }
    }
</script>

<style scoped lang="stylus">
  @import "./../../../../assets/common.styl"
.ai-robot
  background $c-back
  text-align center
  margin 20px auto
</style>
